/**
 */
package ConnectorGenerator.ElementArchitecture.impl;

import ConnectorGenerator.ElementArchitecture.ElementArchitecturePackage;
import ConnectorGenerator.ElementArchitecture.RemoteBinding;
import ConnectorGenerator.ElementArchitecture.RemoteEndpoint;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Remote Binding</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.RemoteBindingImpl#getEndpoints <em>Endpoints</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RemoteBindingImpl extends EObjectImpl implements RemoteBinding {
	/**
	 * The cached value of the '{@link #getEndpoints() <em>Endpoints</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEndpoints()
	 * @generated
	 * @ordered
	 */
	protected RemoteEndpoint endpoints;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RemoteBindingImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ElementArchitecturePackage.Literals.REMOTE_BINDING;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RemoteEndpoint getEndpoints() {
		return endpoints;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetEndpoints(RemoteEndpoint newEndpoints, NotificationChain msgs) {
		RemoteEndpoint oldEndpoints = endpoints;
		endpoints = newEndpoints;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS, oldEndpoints, newEndpoints);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEndpoints(RemoteEndpoint newEndpoints) {
		if (newEndpoints != endpoints) {
			NotificationChain msgs = null;
			if (endpoints != null)
				msgs = ((InternalEObject)endpoints).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS, null, msgs);
			if (newEndpoints != null)
				msgs = ((InternalEObject)newEndpoints).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS, null, msgs);
			msgs = basicSetEndpoints(newEndpoints, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS, newEndpoints, newEndpoints));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS:
				return basicSetEndpoints(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS:
				return getEndpoints();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS:
				setEndpoints((RemoteEndpoint)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS:
				setEndpoints((RemoteEndpoint)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ElementArchitecturePackage.REMOTE_BINDING__ENDPOINTS:
				return endpoints != null;
		}
		return super.eIsSet(featureID);
	}

} //RemoteBindingImpl
